package com.lhb.email.handle;



import com.lhb.common.model.UnifyResponseObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * @author 86131
 * @version 1.0
 * @description 全局异常处理器
 * @date 2025/3/30 下午7:56
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandle {


    @ExceptionHandler(RuntimeException.class)
    public UnifyResponseObject<RuntimeException> exception(RuntimeException e) {
        log.error(e.getMessage(), e);
        return UnifyResponseObject.fail(e.getMessage());
    }
    @ExceptionHandler(Exception.class)
    public UnifyResponseObject<Exception> exception(Exception e) {
        log.error(e.getMessage(), e);
        return UnifyResponseObject.fail(e.getMessage());
    }
}
